package com.lbc.common.enums;

public enum RoleEnum {

    ROLE_ADMIN(1,"admin","超级管理员"),
    ROLE_USER(2,"user","爱心人士"),
    ROLE_SCHOOL(3,"school","学校"),
    ROLE_ORGANIZATION(4,"organization","爱心机构"),
    ROLE_PARENTS(5,"parents","父母");

    private int type;
    private String roleKey;
    private String desc;

    public static <T extends RoleEnum> T getByType(Integer type, Class<T> enumClass) {
        for (T each : enumClass.getEnumConstants()) {
            if (type.equals(each.getType())) {
                return each;
            }
        }
        return null;
    }

    RoleEnum(int type, String roleKey, String desc) {
        this.type = type;
        this.roleKey = roleKey;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getRoleKey() {
        return roleKey;
    }

    public void setRoleKey(String roleKey) {
        this.roleKey = roleKey;
    }
}
